<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Ranking de Productos"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form >
                
                <h:panelGrid columns="2">
                    <h:outputLabel value="Fecha Inicial" for="productidproduct" />
                    <h:inputText id="productidproduct" value="#{productController.queryStartDate}" />
                     
                    
                    <h:outputLabel value="Fecha Final" for="productname" />
                    <h:inputText id="productname" value="#{productController.queryEndDate}" />
                    
                    
                    <h:commandButton action="#{productController.sQueryRankingProducts}" value="Buscar"></h:commandButton>
                </h:panelGrid>
                
                <h:outputText escape="false" value="No Existen Productos" rendered="#{productController.itemsXId.rowCount == 0}"/>
                <h:panelGroup styleClass="jsfcrud_list_form" rendered="#{productController.itemsXId.rowCount > 0}">
                    <h:outputText value="#{productController.pagination.pageFirstItem + 1}..#{productController.pagination.pageLastItem + 1}/#{productController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{productController.previous}" value="#{bundle.Previous} #{productController.pagination.pageSize}" rendered="#{productController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{productController.next}" value="#{bundle.Next} #{productController.pagination.pageSize}" rendered="#{productController.pagination.hasNextPage}"/>&nbsp;
                    <h:dataTable  value="#{productController.itemsXId}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                         
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Identificacion del Producto"/>
                            </f:facet>
                            <h:outputText value="#{item.productidproduct}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Nombre"/>
                            </f:facet>
                            <h:outputText value="#{item.productname}"/>
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Categoria"/>
                            </f:facet>
                            <h:outputText value="#{item.productcategory}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Precio"/>
                            </f:facet>
                            <h:outputText value="#{item.productlistPrice}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{productController.prepareView}" value="Ver Detalle"/>
                                                        
                        </h:column>
                    </h:dataTable>
                </h:panelGroup>
                  
                <br />
                <br />
                <h:commandLink value="Menu Principal" action="/index" immediate="true" />

            </h:form>
        </ui:define>
    </ui:composition>
</html>
